<?php
//copyright (c) WonderShare
//$Id: index.php 437266 2012-07-27 11:17:42Z xuwh $

define('SITE_PATH', realpath(dirname(__DIR__)) . '/');
define('MODULES_PATH', dirname(dirname(SITE_PATH)) . '/Modules/');
define('APP_PATH', MODULES_PATH . 'protected/admin/');
define('ENVIRONMENT', 'development');//development,testing,production

// date_default_timezone_set("Asia/Chongqing");

// date_default_timezone_set('GMT+0');
if(ENVIRONMENT == 'testing' || ENVIRONMENT == 'production'){
    error_reporting(0);
}else{
    error_reporting(E_ALL | E_STRICT);
}

// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
//app use time
//defined('YII_BEGIN_TIME') or define('YII_BEGIN_TIME',microtime(true));

$yii=MODULES_PATH.'framework/yii.php';
require_once($yii);

$cur_domain = $_SERVER['HTTP_HOST'];
$cookie_domain = preg_replace("/([^\.]+)\.(.+)/i",'$2',$cur_domain);
defined('COOKIE_DOMAIN') or define('COOKIE_DOMAIN',$cookie_domain);

$globals=MODULES_PATH.'protected/globals.php';
$config=require(APP_PATH.'config/main.php');

$app=Yii::createWebApplication($config);
require_once($globals);

$app->run();
